<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>登录页面</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
	<script src="/js/jquery/jquery.min.js"></script>
	<script src="/js/bootstrap/js/bootstrap.min.js"></script>
	<link rel="stylesheet" href="/css/font/css/font-awesome.min.css" >
	<link rel="stylesheet" href="/css/reset.css" >
	<link rel="stylesheet" href="/css/login.css" >
	<script src="/js/plugins/dialog2/dialog.min.js"></script>
	<link rel="stylesheet" href="/js/plugins/dialog2/dialog.css">
	<script src="/js/plugins/jquery-form/jquery.form.js"></script>

	<script>
		$(function () {
			$("#loginForm").ajaxForm(function (data) {
                if (data.success) {
                    //登录成功之后返回用户信息
					//将当前登录成功的用户存储sessionStorage
					//sessionStorage只允许存储String类型,所以所有User对象都要转化为String
					//sessionStorage可以在同一个标签页上,窗口上共享数据
					sessionStorage.setItem("user",JSON.stringify(data.data));
                    //跳转到首页
					//win.parent.如果页面出现重叠的时候,window.parent表示的是页面底层
					//如果没有底层的情况下,window.parent=window
					window.parent.location.href="/index.html";
                }else{
                    $(document).dialog({
                        type : 'confirm',
                        style: 'default',  // default、ios、android
                        titleText: '错误',
                        content: data.msg,
                    });
				}
            })
        })
	</script>
</head>
<body>
<div class="container" >
	<h5>登录</h5>

	<div0 class="card card-container ">
		<i id="profile-img" class="fa fa-user-circle fa-5x profile-img" ></i>
		<form class="form-signin" id="loginForm" action="/sessions" method="post">
			<input type="email"  name="email" value="dafei@wolfcode.cn" class="form-control badge-pill" placeholder="邮箱"  >
			<input type="password"  name="password" value="1" class="form-control badge-pill" placeholder="密码" >
			<a href="forget.html" class="forgot-password">
				忘记密码？
			</a>
			<button class="btn btn-lg badge-pill" type="submit" >登录</button>
		</form>
	</div0>


	<a href="register.html" class="registerLink" >
		新用户？点击这里注册
	</a>
</div>

</body>
</html>
